package com.yufuchang;

import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.InitBinder;

/**
 * Created by yufuchang on 2020/8/13.
 */
@ControllerAdvice
public class GlobalConfig {

    @InitBinder("user")
    public void init1(WebDataBinder webDataBinder){
        webDataBinder.setFieldDefaultPrefix("user.");
    }

    @InitBinder("book")
    public void init2(WebDataBinder webDataBinder){
        webDataBinder.setFieldDefaultPrefix("book.");
    }
}
